import React, { Component } from 'react';
import queryString from 'query-string';
import axios from 'axios'
class Index extends Component {
    constructor(props){
        super(props)
        this.state ={
            detail:{}
        }
    }
    componentDidMount(){
        var {id}=queryString.parse(window.location.search)
        console.log(id);
        axios.get(`http://122.112.161.135:4000/api/movieDetail?id=${id}`).then(res=>{
            console.log(res.data.res);
            this.setState({
                detail:res.data.res[0]
            })
        })
    }
    render() {
        var detail =this.state.detail
        return (
            <div>
                <img src={detail.pic} alt="" />
                <p>{detail.title}</p>
            </div>
        );
    }
}

export default Index;
